/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.storebits.testsystem;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Entity
@Table(name = "pickuplocation")
@NamedQueries({
    @NamedQuery(name = "Pickuplocation.findAll", query = "SELECT p FROM Pickuplocation p")})
public class Pickuplocation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idPickUpLocation")
    private Integer idPickUpLocation = new Integer(0);
    @Size(max = 200)
    @Column(name = "address")
    private String address;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pickUpLocation")
    private Collection<Carreservation> carreservationCollection;

    public Pickuplocation() {
    }

    public Pickuplocation(Integer idPickUpLocation) {
        this.idPickUpLocation = idPickUpLocation;
    }

    public Integer getIdPickUpLocation() {
        return idPickUpLocation;
    }

    public void setIdPickUpLocation(Integer idPickUpLocation) {
        this.idPickUpLocation = idPickUpLocation;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Collection<Carreservation> getCarreservationCollection() {
        return carreservationCollection;
    }

    public void setCarreservationCollection(Collection<Carreservation> carreservationCollection) {
        this.carreservationCollection = carreservationCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPickUpLocation != null ? idPickUpLocation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pickuplocation)) {
            return false;
        }
        Pickuplocation other = (Pickuplocation) object;
        if ((this.idPickUpLocation == null && other.idPickUpLocation != null) || (this.idPickUpLocation != null && !this.idPickUpLocation.equals(other.idPickUpLocation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return address;
    }
    
}
